package com.carefree.bookmall.service;


import com.carefree.bookmall.common.vo.BookQueryVo;
import com.carefree.bookmall.common.vo.PageVO;
import com.carefree.bookmall.entity.Book;
import com.carefree.bookmall.exception.CustomException;

import java.util.List;

/**
 * @author Aurora
 */
public interface BookService {

    /**
     * 根据类型查询书籍信息
     *
     * @param recommendType 推荐类型
     * @param pageNumber    页数
     * @param pageSize      每页显示数
     * @return
     */
    public List<BookQueryVo> queryBookByRecommendType(Integer recommendType, int pageNumber, int pageSize) throws CustomException;

    /**
     * 根据类型分页查询书籍信息
     *
     * @param recommendType 推荐类型（hot、new、scroll）
     * @param pageNumber    页码
     * @param pageSize      每页显示记录数
     * @return
     * @throws CustomException
     */
    public PageVO pageBookByRecommendType(String recommendType, int pageNumber, int pageSize) throws CustomException;

    /**
     * 估计书籍id查询书籍信息
     *
     * @param bookId 书籍id
     * @return book对象
     * @throws CustomException
     */
    public Book queryBookById(Integer bookId) throws CustomException;

    /**
     * 估计书籍id查询书籍信息
     *
     * @param bookId 书籍id
     * @return BookQueryVo
     */
    public BookQueryVo queryBookByBookId(Integer bookId) throws CustomException;


    /**
     * 根据关键字分页查询书籍信息
     *
     * @param keyword    搜索关键字
     * @param pageNumber 页数
     * @return
     */
    public PageVO searchBooksByKeyword(String keyword, int pageNumber, int pageSize);

    /**
     * 添加推荐类型
     *
     * @param bookId        书籍id
     * @param recommendType 推荐类型
     * @return
     */
    public boolean addRecommend(Integer bookId, Integer recommendType) throws CustomException;

    /**
     * 删除推荐类型信息
     *
     * @param bookId
     * @param recommendType
     * @return
     */
    public boolean remoteRecommend(Integer bookId, Integer recommendType) throws CustomException;

    /**
     * 根据书籍id删除书籍信息
     *
     * @param bookId 书籍id
     * @return
     */
    public boolean removeBookByBookId(Integer bookId) throws CustomException;

    /**
     * 添加书籍信息
     *
     * @param book 书籍信息
     * @return
     */
    public boolean addBook(Book book) throws CustomException;

    /**
     * 修改书籍信息
     *
     * @param book 书籍信息
     * @return
     */
    public boolean modifyBook(Book book);

}
